package com.bond.jumber.server.netty;

import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;

import java.util.HashMap;
import java.util.Map;

/**
 * 管理channel
 */
public class ChannelGroupContext {

    /**
     * 管理websocket连接
     */
    public static final ChannelGroup websocketClientSet = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);

    /**
     * 管理jumperCliet连接
     */
    public static final ChannelGroup jumperClientSet = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);

    /**
     * 将websocket连接与jumperClient连接建立关系
     */
    public static final Map<Channel, Channel> channelMap = new HashMap<>();

    public static final Map<String, Channel> webSocketChanelMap = new HashMap<>();
    public static final Map<String, Channel> jumperClientChanelMap = new HashMap<>();

}
